package com.aabte.design.pattern.structural.proxy.dynamicproxy;

import com.aabte.design.pattern.structural.proxy.IOrderService;
import com.aabte.design.pattern.structural.proxy.Order;
import com.aabte.design.pattern.structural.proxy.OrderServiceImpl;

public class Test {
    public static void main(String[] args) {

        Order order = new Order();
        order.setUserId(1);

        IOrderService orderServiceDynamicProxy = (IOrderService) new OrderServiceDynamicProxy(new OrderServiceImpl()).bind();

        orderServiceDynamicProxy.saveOrder(order);

        // 动态代理 before code
        // 动态代理分配到[db1]处理数据
        // Service层调用Dao层添加Order
        // Dao层添加Order成功

    }
}
